<template>
  <div>
    <el-row type="flex">
      <el-col :span="4">
        <div class="userinfo">
          <img
            :src="$axios.defaults.baseURL + commentData.account.defaultAvatar"
            alt=""
          />
          <p class="nickname">{{ commentData.account.nickname }}</p>
          <p class="grade">LV.8</p>
        </div>
        <div>{{ date }}</div>
      </el-col>
      <el-col :span="20">
        <p>{{ commentData.content }}</p>
        <el-input
          v-model="input"
          placeholder="添加回复"
          @focus="isShow = true"
          @blur="isShow = false"
        ></el-input>
        <el-button v-if="isShow" type="primary" size="mini">回复</el-button>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import moment from "moment";
export default {
  data() {
    return {
      isShow: false,
      input: "",
    };
  },
  props: {
    commentData: Object,
  },

  computed: {
    date() {
      return moment(this.commentData.updated_at).format("YYYY-MM-DD");
    },
  },
};
</script>

<style lang="less" scoped>
.el-row {
  padding: 20px 0;
  border-bottom: 1px dashed #ccc;
}
.userinfo {
  overflow: hidden;
  img {
    width: 44px;
    height: 44px;
    vertical-align: middle;
    float: left;
  }

  .grade {
    color: #f00;
  }
}
.el-button {
  float: right;
  margin-top: 5px;
}
</style>